<?php

 if (!defined('BASEPATH'))
     exit('No esta permitido el acceso directo');

 class Model_usuario extends CI_Model {

     var $usuario = '';
     var $clave = '';
     var $correoElectronico = '';
     var $telefono = "";



     function __construct() {
         // Call the Model constructor
         parent::__construct();

     }




     function get_last_ten_entries() {
         $query = $this->db->get('entries', 10);
         return $query->result();

     }




     function insert_entry() {
         $this->usuario = $_POST['user'];
         $this->clave = $_POST['pwd'];
         $this->correoElectronico = $_POST['email'];
         $this->telefono = $_POST['telefono'];
         $permisos = $_POST['permisos'];

         //Otorgando permisos
         foreach ($permisos as $permiso) {
             $variables[$permiso] = "Y";
         }



         $this->db->insert('USUARIO', $this);
         $id = $this->db->insert_id();
         $this->db->insert('PERFIL', $variables);

     }




     function update_entry() {
         $this->title = $_POST['title'];
         $this->content = $_POST['content'];
         $this->date = time();

         $this->db->update('entries', $this, array('id' => $_POST['id']));

     }




 }

// END Model Class

/* End of file Model_usuario.php */
/* Location: ./application/models/Model_usuario.php */